package com.sugar.real.estate.module.business.service.apartment;

import com.sugar.real.estate.framework.common.pojo.PageParam;
import com.sugar.real.estate.framework.common.pojo.PageResult;
import com.sugar.real.estate.module.business.controller.admin.apartment.vo.ApartmentPageReqVO;
import com.sugar.real.estate.module.business.controller.admin.apartment.vo.ApartmentRespVO;
import com.sugar.real.estate.module.business.controller.admin.apartment.vo.ApartmentSaveReqVO;
import com.sugar.real.estate.module.business.controller.admin.apartment.vo.ApartmentUpdateReqVO;
import com.sugar.real.estate.module.business.controller.app.apartment.vo.AppApartmentDetailRespVO;
import com.sugar.real.estate.module.business.controller.app.apartment.vo.AppApartmentPageReqVO;
import com.sugar.real.estate.module.business.controller.app.apartment.vo.AppApartmentSimpleRespVO;
import com.sugar.real.estate.module.business.dal.dataobject.apartment.ApartmentHouseTypeDO;
import com.sugar.real.estate.module.business.dal.dataobject.apartment.ApartmentSalespersonDO;
import com.sugar.real.estate.module.infra.controller.admin.file.vo.file.FileUploadReqVO;

import javax.validation.Valid;
import java.io.IOException;
import java.util.List;

/**
 * 楼盘/公寓 Service 接口
 *
 * @author Ysugar
 */
public interface ApartmentService {

    /**
     * 创建楼盘/公寓
     *
     * @param createReqVO 创建信息
     * @return 编号
     */
    Long createApartment(@Valid ApartmentSaveReqVO createReqVO);

    /**
     * 更新楼盘/公寓
     *
     * @param updateReqVO 更新信息
     */
    void updateApartment(@Valid ApartmentSaveReqVO updateReqVO);

    /**
     * 删除楼盘/公寓
     *
     * @param id 编号
     */
    void deleteApartment(Long id);

    /**
    * 批量删除楼盘/公寓
    *
    * @param ids 编号
    */
    void deleteApartmentListByIds(List<Long> ids);

    /**
     * 获得楼盘/公寓
     *
     * @param id 编号
     * @return 楼盘/公寓
     */
    ApartmentRespVO getApartment(Long id);

    /**
     * 获得楼盘/公寓分页
     *
     * @param pageReqVO 分页查询
     * @return 楼盘/公寓分页
     */
    PageResult<ApartmentRespVO> getApartmentPage(ApartmentPageReqVO pageReqVO);

    PageResult<AppApartmentSimpleRespVO> appGetApartmentPage(AppApartmentPageReqVO reqVO);

    List<AppApartmentSimpleRespVO> getApartmentListByMap(AppApartmentPageReqVO reqVO);

    AppApartmentDetailRespVO appGetApartment(Long id, Long userId);

    void importApartmentExcel(FileUploadReqVO uploadReqVO) throws IOException;

    void importExcel(FileUploadReqVO uploadReqVO, Long apartmentId);

    // ==================== 子表（楼盘/公寓户型） ====================

    /**
     * 获得楼盘/公寓户型分页
     *
     * @param pageReqVO 分页查询
     * @param apartmentId 楼盘/公寓ID
     * @return 楼盘/公寓户型分页
     */
    PageResult<ApartmentHouseTypeDO> getApartmentHouseTypePage(PageParam pageReqVO, Long apartmentId);

    /**
     * 创建楼盘/公寓户型
     *
     * @param apartmentHouseType 创建信息
     * @return 编号
     */
    Long createApartmentHouseType(@Valid ApartmentHouseTypeDO apartmentHouseType);

    /**
     * 更新楼盘/公寓户型
     *
     * @param apartmentHouseType 更新信息
     */
    void updateApartmentHouseType(@Valid ApartmentHouseTypeDO apartmentHouseType);

    /**
     * 删除楼盘/公寓户型
     *
     * @param id 编号
     */
    void deleteApartmentHouseType(Long id);

    /**
    * 批量删除楼盘/公寓户型
    *
    * @param ids 编号
    */
    void deleteApartmentHouseTypeListByIds(List<Long> ids);

	/**
	 * 获得楼盘/公寓户型
	 *
	 * @param id 编号
     * @return 楼盘/公寓户型
	 */
    ApartmentHouseTypeDO getApartmentHouseType(Long id);

    // ==================== 子表（楼盘/公寓销售人员） ====================

    /**
     * 获得楼盘/公寓销售人员分页
     *
     * @param pageReqVO 分页查询
     * @param apartmentId 楼盘/公寓ID
     * @return 楼盘/公寓销售人员分页
     */
    PageResult<ApartmentSalespersonDO> getApartmentSalespersonPage(PageParam pageReqVO, Long apartmentId);

    /**
     * 创建楼盘/公寓销售人员
     *
     * @param apartmentSalesperson 创建信息
     * @return 编号
     */
    Long createApartmentSalesperson(@Valid ApartmentSalespersonDO apartmentSalesperson);

    /**
     * 更新楼盘/公寓销售人员
     *
     * @param apartmentSalesperson 更新信息
     */
    void updateApartmentSalesperson(@Valid ApartmentSalespersonDO apartmentSalesperson);

    /**
     * 删除楼盘/公寓销售人员
     *
     * @param id 编号
     */
    void deleteApartmentSalesperson(Long id);

    /**
    * 批量删除楼盘/公寓销售人员
    *
    * @param ids 编号
    */
    void deleteApartmentSalespersonListByIds(List<Long> ids);

	/**
	 * 获得楼盘/公寓销售人员
	 *
	 * @param id 编号
     * @return 楼盘/公寓销售人员
	 */
    ApartmentSalespersonDO getApartmentSalesperson(Long id);

    void updateApartmentStatus(@Valid ApartmentUpdateReqVO updateReqVO);
}